part of '../../repository.dart';

const _kGooglePlayPurchasedSubscriptionTransactionTrialPeriodOfferTypeValue = 'trial_period';
const _kGooglePlayPurchasedSubscriptionTransactionPromotionalOfferTypeValue = 'promotional';
const _kGooglePlayPurchasedSubscriptionTransactionRegularOfferTypeValue = 'regular';

class _GooglePlayPurchasedSubscriptionTransactionOfferTypeDto extends Equatable {
  const _GooglePlayPurchasedSubscriptionTransactionOfferTypeDto._internal({
    required this.offerTypeString,
  });

  final String offerTypeString;

  @override
  List<Object?> get props {
    return [
      offerTypeString,
    ];
  }

  factory _GooglePlayPurchasedSubscriptionTransactionOfferTypeDto.fromString(
      String offerTypeString) {
    return _GooglePlayPurchasedSubscriptionTransactionOfferTypeDto._internal(
      offerTypeString: offerTypeString,
    );
  }

  GooglePlayPurchasedSubscriptionTransactionOfferType toEntity() {
    return switch (offerTypeString) {
      _kGooglePlayPurchasedSubscriptionTransactionTrialPeriodOfferTypeValue =>
        GooglePlayPurchasedSubscriptionTransactionOfferType.trialPeriod,
      _kGooglePlayPurchasedSubscriptionTransactionPromotionalOfferTypeValue =>
        GooglePlayPurchasedSubscriptionTransactionOfferType.promotional,
      _kGooglePlayPurchasedSubscriptionTransactionRegularOfferTypeValue =>
        GooglePlayPurchasedSubscriptionTransactionOfferType.regular,
      _ => throw UnimplementedError(),
    };
  }
}
